/*
 * Copyright 2011 Marcos Fabio Pereira
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.moveme.network.payload;

import java.nio.ByteBuffer;

/**
 * Packet header.
 * 
 * @author Marcos Fabio Pereira
 * 
 */
public class PSMoveServerPacketHeader {

    public static final int HEADER_SIZE = 20;

    public static final int STANDARD_STATE_CODE = 0x1;

    public static final int CAMERA_STATE_CODE = 0x3;

    public static final int CAMERA_FRAME_CODE = 0x2;

    public int magic;

    public int moveMeServerVersion;

    public int payloadCode;

    public int payloadLength;

    public int packetIndex;

    public PSMoveServerPacketHeader(ByteBuffer byteBuffer) {
        magic = byteBuffer.getInt(0);
        moveMeServerVersion = byteBuffer.getInt(4);
        payloadCode = byteBuffer.getInt(8);
        payloadLength = byteBuffer.getInt(12);
        packetIndex = byteBuffer.getInt(16);
    }

}
